import { registerFormDetailProvider } from '@ibiz-template/runtime';
import { withInstall } from '@ibiz-template/vue3-util';
import { App } from 'vue';
import FormUserControl from './form-user-control';
import { FormUserControlProvider } from './form-user-control.provider';

export const IBizFormUserControl = withInstall(
  FormUserControl,
  function (v: App) {
    // 全局注册表单成员插件组件
    v.component(FormUserControl.name, FormUserControl);
    // 全局注册表单成员适配器，FORM_USERCONTROL是插件类型，R9FormDetailPluginId是插件标识
    registerFormDetailProvider(
      'FORM_USERCONTROL_R9FormDetailPluginId',
      () => new FormUserControlProvider(),
    );
  },
);

export default IBizFormUserControl;
